import request from '@/utils/request'

// 查询信息通告列表
export function listCircula(query) {
  return request({
    url: '/system/circula/list',
    method: 'get',
    params: query
  })
}

// 查询信息通告详细
export function getCircula(circulaId) {
  return request({
    url: '/system/circula/' + circulaId,
    method: 'get'
  })
}

// 新增信息通告
export function addCircula(data) {
  return request({
    url: '/system/circula',
    method: 'post',
    data: data
  })
}

// 修改信息通告
export function updateCircula(data) {
  return request({
    url: '/system/circula',
    method: 'put',
    data: data
  })
}

// 删除信息通告
export function delCircula(circulaId) {
  return request({
    url: '/system/circula/' + circulaId,
    method: 'delete'
  })
}

// 导出信息通告
export function exportCircula(query) {
  return request({
    url: '/system/circula/export',
    method: 'get',
    params: query
  })
}

// 查询下拉树结构
export function treeselect() {
  return request({
    url: '/system/statute/treeselect',
    method: 'get'
  })
}

// 置顶修改
export function changeTop(circulaId, istop) {
  const data = {
    circulaId,
    istop
  }
  return request({
    url: '/system/circula/changeTop',
    method: 'put',
    data: data
  })
}

//下载文件
export function getFile (url){
  return request({
    url: url,
    method: 'get',
    responseType: 'arraybuffer'
  })
}
